package com.langrensha.langrensha.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {

    private Integer code;
    private Object data;
    private String msg;


    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public static Result success(Object data) {
        return new Result(200, data, "success");
    }


    public static Result fail() {
        return new Result(400, "fail");
    }

    public Result msg(String msg) {
        this.msg = msg;
        return this;
    }

    public Result data(Object data) {
        this.data = data;
        return this;
    }

    public Result code(Integer code) {
        this.code = code;
        return this;
    }



}
